package exam.test6;

import java.io.InputStream;
import java.util.Scanner;

public class Triangle2 {
    private int width;
    private int height;

    public Triangle2(InputStream inputStream) {
        Scanner scanner = new Scanner(inputStream);
        this.width = Integer.parseInt(scanner.next());
        this.height = Integer.parseInt(scanner.next());
    }

    @Override
    public String toString() {
        return "Triangle: width=" + width + ", height=" + height;
    }

    public static void main(String[] args) {
        System.out.print("Please input triangle width and height: ");
        Triangle2 triangle = new Triangle2(System.in);
        System.out.println("Triangle: width=" + triangle.getWidth() + ", height=" + triangle.getHeight());

        triangle.setWidth(60);
        triangle.setHeight(30);
        System.out.println("Triangle: width=" + triangle.getWidth() + ", height=" + triangle.getHeight());
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }
}
